#ifndef CWIND_H_
#define CWIND_H_
//-----------------------------基本头文件包含--------------------------------------------------------
#include "includes.h"
//--------------------------------------------------------------------------------------------------

//-----------------------------MCU选择定义-----------------------------------------------------------
#define MCU_STM32
//--------------------------------------------------------------------------------------------------

//-----------------------------类型定义--------------------------------------------------------------
typedef enum{false,true}BOOLDef;
typedef enum{NOCTRL=0x00,PWMCTRL=0x01,SPDCTRL=0x02,POSCTRL=0x04,MODCTRL=0x08,TCKCTRL=0x10}CtrlFlagDef;
typedef struct{float leftval;float rightval;}BfloatDef;
//---------------------------------------------------------------------------------------------------

//-----------------------------控制API----------------------------------------------------------------
BfloatDef cw_getspeed(SpeedUnitDef unit);//读取速度
BfloatDef cw_getpostition(PostitionUnitDef unit);//读取路程
BfloatDef cw_getrestpostition(PostitionUnitDef unit);//读取剩余路程

int waitposfor(double diearea);//路程阻塞函数
void cw_clearpostition(void);//清空路程
void cw_brake(void);//刹车

CtrlFlagDef cw_getcontrolflag(void);//读取控制标志
void cw_setcontrolflag(CtrlFlagDef flag);//设置控制标志

void cw_modelctrl(float velocity,float omega,float distance);//模型控制
void cw_spinfor(float leftspeed, float rightspeed);//速度控制
void cw_spinto(float leftspeed,float rightspeed,float leftdistance,float rightdistance);//速度路程控制
//----------------------------------------------------------------------------------------------------

//-----------------------------接口函数和变量-----------------------------------------------------------
extern uint8_t CWindBuf[100];
#ifdef MCU_STM32
	//串口发送接口
	#define CWINDSEND(x,y)
	//串口中断接收服务函数
	void cwindUartISR(void);
	void Uart_RxAgain(UART_HandleTypeDef *huart);
#endif
//-----------------------------------------------------------------------------------------------------
#endif
